﻿package com.devilcat.dt{
	public class Movedt {
		public var Name:String;
		public var Type:String;
		public var Attack:Number;
		public var Accuracy:Number;
		public var Category:String;
		public var Critical:Number;
		public var MaxAttack:Number;
		public var MaxAccuracy:Number;
		public var MaxCritical:Number;
		public var PP:Number;
		public var Effect:XMLList;
		public function Movedt(_Name:String){
			var baseXML:XMLList = Gamedt.movesXML[_Name];
			Name=_Name;
			Type=baseXML.Type;
			MaxAttack=baseXML.Atk;
			MaxAccuracy=baseXML.Acc;
			if (String(baseXML.C)!="") {
				MaxCritical=8;
			} else {
				MaxCritical=16;
			}
			setDefaultValue();
			PP=9-Math.round(Number(baseXML.PP)/5);
			Category=baseXML.Cat;
			Effect=baseXML.Effect;
		}
		public function setDefaultValue(){
			Critical=MaxCritical
			Attack=MaxAttack;
			Accuracy=MaxAccuracy;			
		}
		public function isCritical():Boolean {
			if (Math.round(Math.random()*Critical)==1) {
				return true;
			} else {
				return false;
			}
		}
	}
}